<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div>
    <strong>Hello world!</strong>
  </div>

  <script>
    const elem = document.querySelector('div')

    // innerHTML
    // 获取元素的内容时，保留首尾空格、连续的空格、换行、标签
    console.log('elem.innerHTML', elem.innerHTML)

    // 修改元素的内容时，识别标签
    elem.innerHTML = '<strong>Hello world!</strong>'
  </script>
</body>

</html>